import os
import requests
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.webdriver.chrome.options import Options

options = Options()
options.add_argument("--headless")
options.add_argument("--no-sandbox")

# Инициализируем веб-драйвер
driver = webdriver.Chrome(options=options)

def install_imgs(page: int):
    link: str = f"https://wowlol.ru/wowfap/{page}"
    driver.get(link)
    html = driver.page_source
    soup = BeautifulSoup(html, "html.parser")

    imgs = soup.select('#maincolumn div.block div.bcontent div.binner img[src]')

    imgs_urls = [img['src'] for img in imgs]


    for index, url in enumerate(imgs_urls):
        r = requests.get(url)
        with open(f'photos/{index}.jpg', 'wb') as f:
            f.write(r.content)


    
